// 索引控制模块
;(function(root) {
    
    function Index(len) {
        this.index = 0
        this.len = len
    }

    Index.prototype = {
        prev(){ // 获取上一个索引
            return this.get(-1)
        },
        next(){
            return this.get(1)
        },
        get(val){ // 当前索引
            this.index = (this.index + val + this.len) % this.len
            return this.index
        }
    }
    root.controlIndex = Index
})(window.player || (window.player = {}))